﻿Imports TallComponents.Web.Storage
Imports DatabaseStorageDemoVB.DatabaseStorageDemo.Storage

Public Class _Default
   Inherits System.Web.UI.Page

   Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
      If Not String.IsNullOrEmpty(Request.Params("doc")) Then
         pdfViewer.StorageKey = Request.Params("doc")
      End If

   End Sub

   Protected ReadOnly Property Documents() As IEnumerable(Of DatabaseDocumentInfo)
      Get
         Return DirectCast(PdfStorage.Provider, DatabaseStorageProvider).ListDocuments()
      End Get
   End Property

   Protected Sub OnAddClicked(sender As Object, e As EventArgs)
      If Upload1.PostedFile IsNot Nothing AndAlso Upload1.PostedFile.ContentLength > 0 Then
         PdfStorage.Provider.StoreFile(Upload1.PostedFile)
      End If
   End Sub


End Class